package com.example.space;


import java.util.ArrayList;

import com.example.jhf.R;




import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ClassAlbumAdapter extends BaseAdapter {
	private ArrayList<ClassAlbumPer> data;
	private Context context;
	private LayoutInflater inflater;
public ClassAlbumAdapter(Context context, ArrayList<ClassAlbumPer> data){
	this.context = context;
	this.inflater = LayoutInflater.from(context);
	this.data = data;
}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return data.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final ViewHolder viewHolder;
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.classalbumitem, null);
			viewHolder = new ViewHolder();
			viewHolder.classtuBitmap = (ImageView) convertView
					.findViewById(R.id.classxc_id);
			viewHolder.classtubiao = (TextView) convertView
					.findViewById(R.id.classtutm_id);
			viewHolder.classzhuozhe = (TextView) convertView
					.findViewById(R.id.classzz_id);
			viewHolder.classtutiem = (TextView) convertView
					.findViewById(R.id.classtiem_id);
			viewHolder.classtuNum = (TextView) convertView
					.findViewById(R.id.classcs_id);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		viewHolder.classtubiao.setText(data.get(position).getClasstubiao());
		viewHolder.classzhuozhe.setText(data.get(position).getClasszhuozhe());
		viewHolder.classtutiem.setText(data.get(position).getClasstutiem());
		viewHolder.classtuNum.setText(data.get(position).getClasstuNum());
		return convertView;
	}
public static class ViewHolder{
	ImageView classtuBitmap;
	TextView classtubiao;
	TextView classzhuozhe;
	TextView classtutiem;
	TextView classtuNum;
}
}
